import request from '@/utils/request'

/**
 * 根据项目id查询网关
 */
export function allGateway(projectId) {
  return request({
    url: '/admin-api/business/gateway/' + projectId,
    method: 'get'
  })
}

export function listSelect() {
  return request({
    url: '/admin-api/business/gateway/list/select',
    method: 'get'
  })
}

/**
 * 网关管理表格获取数据
 */
export function listGateway(query) {
  return request({
    url: '/admin-api/business/gateway/list',
    method: 'get',
    params: query
  })
}

export function getGateway(gatewayId) {
  console.log(gatewayId)
  return request({
    url: '/admin-api/business/gateway/getGatewayInfo',
    method: 'get',
    params: {
      gatewayId: gatewayId
    }
  })
}

export function addGateway(data) {
  return request({
    url: '/admin-api/business/gateway',
    method: 'post',
    data: data
  })
}

export function updateGateway(data) {
  return request({
    url: '/admin-api/business/gateway',
    method: 'put',
    data: data
  })
}

export function delGateway(gatewayId) {
  return request({
    url: '/admin-api/business/gateway/' + gatewayId,
    method: 'delete'
  })
}
